package logic

import (
	"context"
	"srv/srv"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type AdmHouseStatusLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewAdmHouseStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdmHouseStatusLogic {
	return &AdmHouseStatusLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *AdmHouseStatusLogic) AdmHouseStatus(req *types.AdmHouseStatusRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	status, err := l.svcCtx.Srv.AdmHouseStatus(l.ctx, &srv.AdmHouseStatusRequest{
		HouseId:     req.HouseId,
		HouseStatus: req.HouseStatus,
	})

	if err != nil {
		return &types.Response{
			Code: 500,
			Msg:  err.Error(),
			Data: nil,
		}, nil

	}

	return &types.Response{
		Code: 200,
		Msg:  "审核房源上架成功",
		Data: map[string]interface{}{
			"Type": status.Type,
		},
	}, nil
}
